package com.rsk.dao;

import com.rsk.entity.SysCompanyTypes;
import com.rsk.entity.SysMenu;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

@Repository
public interface SysCompanyTypesRepository extends JpaRepository<SysCompanyTypes, Long>,JpaSpecificationExecutor<SysCompanyTypes>,Serializable {


    @Modifying
    @Query(value = "update sys_company_types set is_del = 1, operator_user =?2, operator_time = NOW() where id =?1", nativeQuery = true)
    public int delSysCompanyTypes(Long id, Long operatorUser);

    @Modifying
    @Query(value = "update sys_company_types set type_name =?2, remarks =?3,operator_user =?4,operator_time = NOW() where id =?1", nativeQuery = true)
    public int updateSysCompanyTypes(Long id,String typeName,String remarks,Long operatorUser);

    @Modifying
    @Query(value = "select 1 from sys_company_types",nativeQuery = true)
    public List<Map<String, Object>> selectSysCompanyTypes(String typeName);

}
